using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class vkAdmisionMap : EntityTypeConfiguration<vkAdmision>
    {
        public vkAdmisionMap()
        {
            // Primary Key
            this.HasKey(t => new { t.Patient_ID, t.Entry_Date, t.Out_Patient, t.Price_Code });

            // Properties
            this.Property(t => t.Patient_ID)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Reference_Physician)
                .HasMaxLength(30);

            this.Property(t => t.Entry_Type)
                .HasMaxLength(25);

            this.Property(t => t.Attending_Physician)
                .HasMaxLength(6);

            this.Property(t => t.Price_Code)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Visa_Number)
                .HasMaxLength(20);

            this.Property(t => t.Entry_Time)
                .HasMaxLength(10);

            this.Property(t => t.Facility)
                .HasMaxLength(20);

            this.Property(t => t.C1st_Guarantor)
                .HasMaxLength(6);

            this.Property(t => t.C2nd_Guarantor)
                .HasMaxLength(6);

            this.Property(t => t.First_Name)
                .HasMaxLength(50);

            this.Property(t => t.Last_Name)
                .HasMaxLength(50);

            this.Property(t => t.Father_Name)
                .HasMaxLength(50);

            this.Property(t => t.Facility_Type)
                .HasMaxLength(20);

            this.Property(t => t.CITY)
                .HasMaxLength(30);

            this.Property(t => t.STATE)
                .HasMaxLength(3);

            this.Property(t => t.ZIP)
                .HasMaxLength(14);

            this.Property(t => t.PHONE)
                .HasMaxLength(19);

            this.Property(t => t.REGION)
                .HasMaxLength(5);

            this.Property(t => t.GENDER)
                .HasMaxLength(7);

            this.Property(t => t.Price_List)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("vkAdmision");
            this.Property(t => t.Patient_ID).HasColumnName("Patient ID");
            this.Property(t => t.Entry_Date).HasColumnName("Entry Date");
            this.Property(t => t.Discharge_Date).HasColumnName("Discharge Date");
            this.Property(t => t.Reference_Physician).HasColumnName("Reference Physician");
            this.Property(t => t.Entry_Type).HasColumnName("Entry Type");
            this.Property(t => t.Attending_Physician).HasColumnName("Attending Physician");
            this.Property(t => t.Out_Patient).HasColumnName("Out Patient");
            this.Property(t => t.Price_Code).HasColumnName("Price Code");
            this.Property(t => t.Visa_Number).HasColumnName("Visa Number");
            this.Property(t => t.Entry_Time).HasColumnName("Entry Time");
            this.Property(t => t.Facility).HasColumnName("Facility");
            this.Property(t => t.Entry_Class).HasColumnName("Entry Class");
            this.Property(t => t.DURATION).HasColumnName("DURATION");
            this.Property(t => t.C1st_Guarantor).HasColumnName("1st Guarantor");
            this.Property(t => t.C2nd_Guarantor).HasColumnName("2nd Guarantor");
            this.Property(t => t.First_Name).HasColumnName("First Name");
            this.Property(t => t.Last_Name).HasColumnName("Last Name");
            this.Property(t => t.Father_Name).HasColumnName("Father Name");
            this.Property(t => t.Floor).HasColumnName("Floor");
            this.Property(t => t.room).HasColumnName("room");
            this.Property(t => t.Facility_Type).HasColumnName("Facility Type");
            this.Property(t => t.CITY).HasColumnName("CITY");
            this.Property(t => t.STATE).HasColumnName("STATE");
            this.Property(t => t.ZIP).HasColumnName("ZIP");
            this.Property(t => t.PHONE).HasColumnName("PHONE");
            this.Property(t => t.REGION).HasColumnName("REGION");
            this.Property(t => t.GENDER).HasColumnName("GENDER");
            this.Property(t => t.Price_List).HasColumnName("Price List");
        }
    }
}
